package com.briup.jd2511.jd2511bookstore.controller;


import com.briup.jd2511.jd2511bookstore.pojo.dto.UserLogin;
import com.briup.jd2511.jd2511bookstore.response.Result;
import com.briup.jd2511.jd2511bookstore.service.UserService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@Tag(name = "用户登录接口")
@RestController
public class AuthController {

	@Resource
	private UserService userService;

	@Operation(summary = "用户登录")
	@PostMapping("/login")
	public Result<String> login(@RequestBody UserLogin user) {
		log.info("用户登录:{}", user);
		return Result.success(userService.login(user));
	}

	@Operation(summary = "退出登录")
	@PostMapping("/logout")
	public Result<String> logout() {
		return Result.success();
	}
}
